package com.ruoyi.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.admin.domain.ZhxJielong;
import com.ruoyi.admin.service.IZhxJielongService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 接龙管理Controller
 * 
 * @author ruoyi
 * @date 2024-11-11
 */
@RestController
@RequestMapping("/ZhxAdmin/ZhxJielong")
public class ZhxJielongController extends BaseController
{
    @Autowired
    private IZhxJielongService zhxJielongService;

    /**
     * 查询接龙管理列表
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZhxJielong zhxJielong)
    {
        startPage();
        List<ZhxJielong> list = zhxJielongService.selectZhxJielongList(zhxJielong);
        return getDataTable(list);
    }

    /**
     * 导出接龙管理列表
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:export')")
    @Log(title = "接龙管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZhxJielong zhxJielong)
    {
        List<ZhxJielong> list = zhxJielongService.selectZhxJielongList(zhxJielong);
        ExcelUtil<ZhxJielong> util = new ExcelUtil<ZhxJielong>(ZhxJielong.class);
        util.exportExcel(response, list, "接龙管理数据");
    }

    /**
     * 获取接龙管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:query')")
    @GetMapping(value = "/{jielongId}")
    public AjaxResult getInfo(@PathVariable("jielongId") Long jielongId)
    {
        return success(zhxJielongService.selectZhxJielongByJielongId(jielongId));
    }

    /**
     * 新增接龙管理
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:add')")
    @Log(title = "接龙管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZhxJielong zhxJielong)
    {
        return toAjax(zhxJielongService.insertZhxJielong(zhxJielong));
    }

    /**
     * 修改接龙管理
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:edit')")
    @Log(title = "接龙管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZhxJielong zhxJielong)
    {
        return toAjax(zhxJielongService.updateZhxJielong(zhxJielong));
    }

    /**
     * 删除接龙管理
     */
    @PreAuthorize("@ss.hasPermi('ZhxAdmin:ZhxJielong:remove')")
    @Log(title = "接龙管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jielongIds}")
    public AjaxResult remove(@PathVariable Long[] jielongIds)
    {
        return toAjax(zhxJielongService.deleteZhxJielongByJielongIds(jielongIds));
    }
}
